﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ESOL.WinUI.BaseForm
{
    public partial class frmBaseDialogyQueryForm : frmBaseDialogyForm
    {
        #region Variable
        protected int DefaultRowCount { get; set; }
        private bool mViewOnly = false;
        public bool ViewOnly
        {
            get { return mViewOnly; }
            set { mViewOnly = value; }
        }
        #endregion

        #region Constructor
        public frmBaseDialogyQueryForm()
        {
            InitializeComponent();
        }
        #endregion

        #region Functions
        protected virtual void Click_Query()
        {
        }
        protected virtual void Click_Confirm()
        {
            this.DialogResult = DialogResult.OK;
        }
        protected virtual void Click_Cancel()
        {
            this.DialogResult = DialogResult.Cancel;
        }
        #endregion

        #region Event
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            Click_Confirm();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Click_Cancel();
        }

        private void btnQuery_Click(object sender, EventArgs e)
        {
            Click_Query();
        }

        protected override void OnShown(EventArgs e)
        {
            if (mViewOnly)
            {
                btnCancel.Visible = false;
                btnConfirm.Location = btnCancel.Location;
            }
            base.OnShown(e);
        }
        #endregion
    }
}
